aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/verify/[code]/+page.server.js
blob: 19453d9dbd6ed9af52c5000cf404219fb610c638 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { get } from "$lib/utils";
import { error, redirect } from "@sveltejs/kit";

export let load = async ({ params: { code } }) => {
  let user;
  try {
    user = await get(`/verify/${code}`);
  } catch (e) {
    console.log(e);
    return { error: "Verification failed" };
  }

  redirect(307, `/${user.username}/settings/account?verified=true`);
};